import request from '@/utils/request'

// 查询基础店铺信息列表
export function listStores(query) {
  return request({
    url: '/system/stores/list',
    method: 'get',
    params: query
  })
}
// 根据数据权限查询基础店铺信息列表
export function listStoresByDS(query) {
  return request({
    url: '/system/stores/listByDataScope',
    method: 'get',
    params: query
  })
}

// 查询基础店铺信息详细
export function getStores(id) {
  return request({
    url: '/system/stores/' + id,
    method: 'get'
  })
}

// 新增基础店铺信息
export function addStores(data) {
  return request({
    url: '/system/stores',
    method: 'post',
    data: data
  })
}

// 修改基础店铺信息
export function updateStores(data) {
  return request({
    url: '/system/stores',
    method: 'put',
    data: data
  })
}

// 删除基础店铺信息
export function delStores(id) {
  return request({
    url: '/system/stores/' + id,
    method: 'delete'
  })
}

// 查询店铺未授权用户列表
export function unallocatedUserList(query) {
  return request({
    url: '/system/stores/authUser/unallocatedList',
    method: 'get',
    params: query
  })
}

// 查询店铺已授权用户列表
export function allocatedUserList(query) {
  return request({
    url: '/system/stores/authUser/allocatedList',
    method: 'get',
    params: query
  })
}

// 取消用户授权店铺
export function authUserCancel(data) {
  return request({
    url: '/system/stores/authUser/cancel',
    method: 'put',
    data: data
  })
}

// 批量取消用户授权角色
export function authUserCancelAll(data) {
  return request({
    url: '/system/stores/authUser/cancelAll',
    method: 'put',
    params: data
  })
}

// 授权用户选择
export function authUserSelectAll(data) {
  return request({
    url: '/system/stores/authUser/selectAll',
    method: 'put',
    params: data
  })
}
